# Maintainer: Junjie Mao <eternal.n08@gmail.com>

_realname=libgnomecanvas
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.30.3
pkgrel=3
pkgdesc="The GNOME canvas library (mingw-w64)"
arch=('any')
depends=("${MINGW_PACKAGE_PREFIX}-gtk2"
         "${MINGW_PACKAGE_PREFIX}-gettext"
         "${MINGW_PACKAGE_PREFIX}-libart_lgpl"
         "${MINGW_PACKAGE_PREFIX}-libglade")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "intltool")
url='https://developer.gnome.org/libgnomecanvas/stable/GnomeCanvas.html'
license=('LGPL2')
source=("https://download.gnome.org/sources/libgnomecanvas/${pkgver%.*}/${_realname}-${pkgver}.tar.gz")
sha256sums=('a8ca85e734ab03ecf1fba7d99e01ae2541d0df539c69a7da9414cde928c116da')

prepare() {
  cd $srcdir/${_realname}-${pkgver}
}

build() {
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
     --prefix=${MINGW_PREFIX} \
     --exec-prefix=${MINGW_PREFIX} \
     --build=${MINGW_CHOST} \
     --host=${MINGW_CHOST} \
     --target=${MINGW_CHOST} \
     --enable-static \
     --enable-shared \
     --enable-glade

  make
}

check() {
  # The test case fails due to a warning on a deprecated property
  plain "skip"
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}"/${_realname}-${pkgver}
  [[ -f COPYING.LIB ]] && install -Dm644 COPYING.LIB ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING.LIB
  [[ -f AUTHORS ]] && install -Dm644 AUTHORS ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/AUTHORS
  [[ -f NEWS ]] && install -Dm644 NEWS ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/NEWS
}
